﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace DHJ.Cost.Migrations
{
    public partial class Added_KitItem : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_KitItem_QcCards_QcCardId",
                table: "KitItem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_KitItem",
                table: "KitItem");

            migrationBuilder.RenameTable(
                name: "KitItem",
                newName: "KitItems");

            migrationBuilder.RenameIndex(
                name: "IX_KitItem_QcCardId",
                table: "KitItems",
                newName: "IX_KitItems_QcCardId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_KitItems",
                table: "KitItems",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_KitItems_QcCards_QcCardId",
                table: "KitItems",
                column: "QcCardId",
                principalTable: "QcCards",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_KitItems_QcCards_QcCardId",
                table: "KitItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_KitItems",
                table: "KitItems");

            migrationBuilder.RenameTable(
                name: "KitItems",
                newName: "KitItem");

            migrationBuilder.RenameIndex(
                name: "IX_KitItems_QcCardId",
                table: "KitItem",
                newName: "IX_KitItem_QcCardId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_KitItem",
                table: "KitItem",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_KitItem_QcCards_QcCardId",
                table: "KitItem",
                column: "QcCardId",
                principalTable: "QcCards",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
